package com.face.gaoml.netlibrary.data.init;

import android.app.Application;
import android.text.TextUtils;


public class SetData {

	public static final String SEX_KEY = "sex";					//性别
	public static final String USER_NAME = "UserName";			//真实姓名
	public static final String NICK_NAME_KEY = "nickname";		//呢称
	public static final String COUNTRY_KEY = "country";			//国家
	public static final String CITY_KEY = "city";				//城市
	public static final String TYPE_KEY = "type";   			//用户类型
	public static final String CAREER_KEY = "career";			//职业
	public static final String INTRODUCTION_KEY = "introduction"; //简介

	public static final String ANSWER_OPEN_KEY = "answer_open"; //问答是否开启
	public static final String WEIXIN_BIND_KEY = "weixin_bind";	//是否绑定微信
	public static final String FIRST_LOGIN_KEY = "first_login"; //首次登录
	public static final String BANK_CARD_KEY = "bank_card"; //绑定银行卡
	public static final String BANK_CARD_FIRST_KEY = "bank_card_first"; //绑定银行卡是
	public static final String ANSWER_CONTENT_KEY = "answer_content"; //前辈回答内容草稿

	public static final String SET_WEN_DA_FIRST = "set_wen_da_first"; //记录问答第一次是否开启
	public static final String SET_BIND_WE_CHAT_FIRST = "set_bind_we_chat_first"; //记录第一次是否显示绑定微信dialog
	public static final String SET_WEN_DA_KAI_TONG = "wen_da_kai_tong"; //问答是否开通过

//	@Inject
	static  Application application;
	/**
	 * 是否开通过问答
	 *
	 * @param isOpen
	 */
	public static void setWenDaKaiTong(boolean isOpen){
		setSp(SET_WEN_DA_KAI_TONG,isOpen);
	}

	public static boolean getWenDaKaiTong(){
		return getSp(SET_WEN_DA_KAI_TONG,false);
	}

	/**
	 * 晚辈——记录我的提问第一次显示绑定微信dialog
	 *
	 * @param isOpen
	 */
	public static void setBindWeChatFirst(boolean isOpen){
		setSp(SET_BIND_WE_CHAT_FIRST,isOpen);
	}

	public static boolean getBindWeChatFirst(){
		return getSp(SET_BIND_WE_CHAT_FIRST,false);
	}


	/**
	 * 记录问答第一次是否开启
	 *
	 * @param isOpen
	 */
	public static void setWenDaFirst(boolean isOpen){
		setSp(SET_WEN_DA_FIRST,isOpen);
	}

	public static boolean getWenDaFirst(){
		return getSp(SET_WEN_DA_FIRST,false);
	}

	/**
	 * 前辈回答内容草稿
	 *
	 * @param content
	 */
	public static void setAnswerContent(String content){
		setSp(ANSWER_CONTENT_KEY,content);
	}

	public static String getAnswerContent(){
		return getSp(ANSWER_CONTENT_KEY);
	}

	/**
	 * 是否显示银行卡引导页
	 *
	 * @param isOpen
	 */
	public static void setBindBankCardFirst(boolean isOpen){
		setSp(BANK_CARD_FIRST_KEY,isOpen);
	}

	public static boolean getBindBankCardFirst(){
		return getSp(BANK_CARD_FIRST_KEY,true);
	}

	/**
	 * 是否绑定银行卡
	 *
	 * @param isOpen
	 */
	public static void setBindBankCard(boolean isOpen){
		setSp(BANK_CARD_KEY,isOpen);
	}

	public static boolean getBindBankCard(){
		return getSp(BANK_CARD_KEY,false);
	}

	/**
	 * 首次登录
	 *
	 * @param isOpen
	 */
	public static void setFirstLogin(boolean isOpen){
		setSp(FIRST_LOGIN_KEY,isOpen);
	}

	public static boolean getFirstLogin(){
		return getSp(FIRST_LOGIN_KEY,false);
	}

	/**
	 * 是否开启问答
	 *
	 * @param isOpen
	 */
	public static void setAnswerOpen(boolean isOpen){
		setSp(ANSWER_OPEN_KEY,isOpen);
	}

	public static boolean getAnswerOpen(){
		return getSp(ANSWER_OPEN_KEY,false);
	}


	/**
	 * 是否回到过 问题
	 * @param idflag
	 * @param isAnswer
     */
	public static void setAnswerQues(String idflag, boolean isAnswer){
		setSp(idflag,isAnswer);
	}

	public static boolean getAnswerQues(String idflag){
		return getSp(idflag,false);
	}






	/**
	 * 是否绑定微信
	 *
	 */

	public static void setBindWinXin(boolean isBind){
		setSp(WEIXIN_BIND_KEY,isBind);
	}

	public static boolean getBindWeiXin(){
		return getSp(WEIXIN_BIND_KEY,false);
	}

	/**
	 *
	 * 用户简介
	 *
	 * @param introduction
     */
	public static void setIntroduction(String introduction){
		setSp(INTRODUCTION_KEY,introduction);
	}

	public static String getIntroduction(){
		return getSp(INTRODUCTION_KEY);
	}

	/**
	 * 职业
	 *
	 * @param career
     */
	public static void setCareer(String career){
		setSp(CAREER_KEY,career);
	}

	public static String getCareer(){
		return getSp(CAREER_KEY);
	}

	/**
	 *
	 * 用户类型 1 前辈  0 晚辈
	 *
	 * @param type
     */
	public static void setUserType(String type){
		setSp(TYPE_KEY,type);
	}

	public static String getUserType(){
		return getSp(TYPE_KEY);
	}

	/**
	 * 呢称
	 *
	 * @param nickName
     */
	public static void setNickName(String nickName){
		setSp(NICK_NAME_KEY,nickName);
	}

	public static String getNickName(){
		return getSp(NICK_NAME_KEY);
	}


	/**
	 * 国家
	 *
	 * @param country
     */
	public static void setCountry(String country){
		setSp(COUNTRY_KEY,country);
	}

	public static String getCountry(){
		return getSp(COUNTRY_KEY);
	}

	/**
	 * 城市
	 *
	 * @param city
     */
	public static void setCity(String city){
		setSp(CITY_KEY,city);
	}

	public static String getCity(){
		return getSp(CITY_KEY);
	}

	/**
	 * 性别
	 * @param sex
     */
	public static void setSex(String sex){
		setSp(SEX_KEY,sex);
	}

	public static String getSex(){
		return getSp(SEX_KEY);
	}

	public static String getFirstTag() {
		return getSp("first_tag");
	}

	public static void setFirstTag(String hxID) {
		setSp("first_tag", hxID);
	}
	
	
	public static String getUserName() {

		return getSp(USER_NAME);
	}

	public static void setUserName(String hxID) {
			GlobalConfig.getInstance().userName = hxID;
			setSp(USER_NAME, hxID);
	}

	public static String getFace() {

		return getSp("iconURl");
	}

	public static void setFace(String hxID) {
			GlobalConfig.getInstance().iconURl = hxID;
			setSp("iconURl", hxID);
	}

	public static String gethxID() {

		return getSp("hxID");
	}

	public static void sethxID(String hxID) {
			GlobalConfig.getInstance().hxID = hxID;
			setSp("hxID", hxID);
	}

	public static String getUserID() {
		return getSp("userID");
	}

	/**
	 * 保存 用户身份
	 * @param userID
	 */
	public static void setIdentity(String userID) {
		if (!TextUtils.isEmpty(userID)) {
			GlobalConfig.getInstance().userID = userID;
			setSp("getIdentity", userID);
		}
	}
	public static String getIdentity() {
		return getSp("getIdentity");
	}

	public static void setUserID(String userID) {
			GlobalConfig.getInstance().userID = userID;
			setSp("userID", userID);
	}

	/**用户电话 保存*/
	public static String getUserPhone() {
		return getSp("userPhone");
	}

	public static void setUserPhone(String userPhone) {
		setSp("userPhone", userPhone);
	}

	private static String getSp(String key) {
		return application.getSharedPreferences("jiemian", 0)
				.getString(key, "");
	}

	private static void setSp(String key, String value) {
		application.getSharedPreferences("jiemian", 0).edit()
				.putString(key, value).commit();
	}

	private static void setSp(String key, boolean value) {
		application.getSharedPreferences("jiemian", 0).edit()
				.putBoolean(key, value).commit();
	}

	private static boolean getSp(String key, boolean defaultValue) {
		return application.getSharedPreferences("jiemian", 0)
				.getBoolean(key, defaultValue);
	}


	/**
	 * 获取聊天对象的 用户名
	 * 
	 * @return
	 */
	public static String getTouUsername(String id) {

		return getSp(id+"name");
	}

	/**
	 * 获取聊天对象的用户名
	 * 
	 * @param hxID
	 */
	public static void setTouserName(String id, String hxID) {
		if (!TextUtils.isEmpty(hxID)) {
			setSp(id+"name", hxID);
		}
	}
	
	/**
	 * 获取聊天对象的 用户头像
	 * 
	 * @return
	 */
	public static String getTouUseFace(String id) {

		return getSp(id+"face");
	}

	/**
	 * 获取聊天对象的用户头像
	 * 
	 * @param hxID
	 */
	public static void setTouserFace(String id, String hxID) {
		if (!TextUtils.isEmpty(hxID)) {
			setSp(id+"face", hxID);
		}
	}
	/**保持环形密码*/
	public static void sethxpass(String random_string){
		setSp("random_string", random_string);
	}
	/**
	 * 获取环形密码
	 */
	public static String gethxpass(){
		return getSp("random_string");
	}
	
	/**设置是否 响铃*/
	public static void setSound(boolean random_string){
		application.getSharedPreferences("jiemian", 0).edit()
		.putBoolean("setSound", random_string).commit();
	}
	/**
	 * 设置是否 响铃
	 */
	public static boolean getSound(){
		
		return application.getSharedPreferences("jiemian", 0)
		.getBoolean("setSound", true);
	}
	
	/**设置是否 振动*/
	public static void setVibrate(boolean random_string){
		application.getSharedPreferences("jiemian", 0).edit()
		.putBoolean("setVibrate", random_string).commit();
	}
	/**
	 * 设置是否 响铃
	 */
	public static boolean getVibrate(){
		
		return application.getSharedPreferences("jiemian", 0)
		.getBoolean("setVibrate", true);
	}
	
	
	/**设置是显示说明*/
	public static void setLoginshow(boolean random_string,String id){
		application.getSharedPreferences("jiemian", 0).edit()
		.putBoolean(id, random_string).commit();
	}
	/**
	 * 设置是否显示说明
	 */
	public static boolean getLoginshow(String id){
		
		return application.getSharedPreferences("jiemian", 0)
		.getBoolean(id, true);
	}
	
	public static void setApplyInfo(String info){
		setSp("apply_info",info);
	}

	public static String getApplyInfo(){
		return getSp("apply_info");
	}

	
}
